#include "StdAfx.h"
#include "BlockVertical.h"

namespace dhis
{

	CBlockVertical::CBlockVertical(const int& w, const int& h, const int& div)
	{
		m_width = w;
		m_height = h;

		int colRemainder = m_width%div;
		m_blockCol = m_width/div;
		m_blockWidth = div;

		if (m_blockCol == 0) {
			m_blockCol = 1;
			m_blockWidth = m_width;
		} else {
			m_blockWidth = div + colRemainder/m_blockCol;
		}

		for (int j = 0; j < m_blockCol; ++j)
		{
			CRectI rect;
			rect.Y = 0;
			rect.Height = m_height;
			rect.X = j*m_blockWidth;

			if (j == (m_blockCol-1)) {
				rect.Width = m_width - rect.X;
			} else {
				rect.Width = m_blockWidth;
			}

			m_rects.push_back(rect);
		}
		m_blockObjs.resize(m_blockCol);
	}

	CBlockVertical::~CBlockVertical(void)
	{
	}

}